package com.itheima.demo;

import com.itheima.domain.Orders;
import com.itheima.domain.User;
import com.itheima.mapper.UserMapper;
import com.itheima.utils.MapperUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class Demo1 {
    public static void main(String[] args) {
        //获取Sqlsession对象
        SqlSession session = MapperUtil.getsession();
        //获取Mapper代理对象
        UserMapper mapper = session.getMapper(UserMapper.class);
        //调用接口方法
        List<User> list = mapper.findAll();
        for (User user : list) {
            System.out.println(user);
        }
        MapperUtil.close(session);
    }
}
